<!-- 餐厅查询 -->
<div class="search">
  <nz-select style="width:100px;margin-right: 5px;" [(ngModel)]="status" nzAllowClear nzPlaceHolder="使用状态"
    (ngModelChange)="searchData()">
    <nz-option *ngFor="let item of statuslist" [nzValue]="item.key" [nzLabel]="item.value"></nz-option>
  </nz-select>
  <nz-select style="width:100px;margin-right: 5px;" [(ngModel)]="state" nzAllowClear nzPlaceHolder="申请状态"
    (ngModelChange)="searchData()">
    <nz-option *ngFor="let item of statelist" [nzValue]="item.key" [nzLabel]="item.value"></nz-option>
  </nz-select>
  <nz-select style="width:100px;margin-right: 5px;" [(ngModel)]="bondstatus" nzAllowClear nzPlaceHolder="押金状态"
    (ngModelChange)="searchData()">
    <nz-option *ngFor="let item of bondstatuslist" [nzValue]="item.key" [nzLabel]="item.value"></nz-option>
  </nz-select>
  <!-- 注册日期:
  <nz-date-picker nzFormat="yyyy-MM-dd" [(ngModel)]="sdate" nzPlaceHolder="开始日期">
  </nz-date-picker>
  ~
  <nz-date-picker nzFormat="yyyy-MM-dd" [(ngModel)]="edate" nzPlaceHolder="结束日期">
  </nz-date-picker> -->
  申请日期:
  <nz-date-picker nzFormat="yyyy-MM-dd" [(ngModel)]="usdate" nzPlaceHolder="开始日期">
  </nz-date-picker>
  ~
  <nz-date-picker nzFormat="yyyy-MM-dd" [(ngModel)]="uedate" nzPlaceHolder="结束日期">
  </nz-date-picker>
  <nz-input-group nzSuffixIcon="anticon anticon-search" style="width:15%;margin-left:1rem;">
    <input type="text" nz-input placeholder="输入餐厅名称/地址/法人姓名" [(ngModel)]="name" (keyup.enter)="searchData()">
  </nz-input-group>
  <a (click)="searchData()">查询</a>
  <a (click)="add()">添加</a>
</div>

<nz-table #ajaxTable nzShowSizeChanger [nzFrontPagination]="false" [nzData]="dataSet" [nzLoading]="loading" [nzTotal]="total"
  [nzShowTotal]="totalTemplate" [(nzPageIndex)]="pageIndex" [(nzPageSize)]="pageSize" (nzPageIndexChange)="searchData()"
  (nzPageSizeChange)="searchData(true)" [nzScroll]="{ x:'2000px',y: '480px' }">
  <thead>
    <tr>
      <th nzWidth="60px" nzLeft="0px">序号</th>
      <th nzWidth="100px">商户名称</th>
      <th nzWidth="250px">地址</th>
      <!-- <th nzWidth="100px">企业法人</th>
      <th nzWidth="100px">法人手机号</th> -->
      <th nzWidth="100px">企业负责人</th>
      <th nzWidth="80px">使用状态</th>
      <!-- <th nzWidth="80px">申请状态</th>
      <th nzWidth="80px">押金状态</th> -->
      <th nzWidth="80px">商户余额</th>
      <th nzWidth="80px">招募奖励</th>
      <th nzWidth="80px">剩余库存</th>
      <th nzWidth="80px">餐币余额</th>
      <th nzWidth="100px">佣金比例(%)</th>
      <th nzWidth="120px">大使奖励比例(‰)</th>
      
      <!-- <th nzWidth="180px">品牌宣传大使</th> -->
      <th nzWidth="120px">申请时间</th>
      <!-- <th nzWidth="80px">创建人</th> -->
      <th nzWidth="120px">更新时间</th>
      <!-- <th nzWidth="80px">审核人</th>
      <th nzWidth="150px">审核时间</th> -->
      <th nzWidth="150px" nzRight="0px">操作</th>
    </tr>
  </thead>
  <tbody>
    <tr *ngFor="let data of ajaxTable.data;index as i">
      <td nzLeft="0px">{{i+1}}</td>
     
      <td>{{data.name}}</td>
      <td>{{data.address}}</td>
      <!-- <td>{{data.legalpersonname}}</td>
      <td>{{data.legalpersontel}}</td> -->
      <td>{{data.legaluser}}</td>
      <td>{{data.status}}</td>
      <!-- <td>{{data.state}}</td>
      <td>{{data.bondstatus}}</td> -->
      <td>{{data.balance}}</td>
      <td>{{data.balanceviter}}</td>
      <td>{{data.coinbalance}}</td>
      <td>{{data.mealbalance}}</td>
      <td>{{data.rate+"%"}}</td>
      <td>{{data.agentrate+"‰"}}</td>
      
      <!-- <td>{{data.agent}}</td> -->
      <td>{{data.applytime | date:"yyyy-MM-dd HH:mm"}}</td>
      <!-- <td>{{data.createuser}}</td> -->
      <td>{{data.createTime | date:"yyyy-MM-dd HH:mm"}}</td>
      <!-- <td>{{data.modifyuser}}</td>
      <td>{{data.modifytime | date:"yyyy-MM-dd HH:mm"}}</td> -->

      <td nzRight="0px">
        <!-- <a (click)="look(data._id)">查看</a> -->
        <a *ngIf="data.status=='有效'" (click)="lock(data._id)">禁用</a>
        <a *ngIf="data.status!='有效'" (click)="open(data._id)">启用</a>
        <a (click)="edit(data._id)">编辑</a>
        <!-- <a (click)="edit(data._id)">审核</a> -->
        <!-- <a (click)="users(data._id)">查看用户</a> -->
        <a (click)="orderlist(data._id)">结算记录</a>
        <a (click)="inverlist(data.legalusercusid)">邀请记录</a>
        <a target="_blank" (click)="payset(data._id)">提现设置</a>
      </td>
    </tr>
  </tbody>
</nz-table>
<ng-template #totalTemplate let-total>
  共 {{total}} 条
</ng-template>
<nz-modal [(nzVisible)]="isVisible" nzTitle="餐厅信息" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()" nzWrapClassName="vertical-center-modal"
  [nzMaskClosable]="false" nzWidth="800">
  <div style="margin-bottom: 16px;" class="scrollbar my-modal">
    <nz-input-group [nzSuffix]="suffixTemplate" nzAddOnBefore="餐厅名称">
      <input type="text" nz-input [(ngModel)]="doc.name">
    </nz-input-group>
    <ng-template #suffixTemplate><i nz-icon nz-tooltip nzTitle="必填信息" nzType="info-circle"></i></ng-template>
    <nz-input-group  nzAddOnBefore="餐厅法人">
      <input type="text" nz-input [(ngModel)]="doc.legalpersonname">
    </nz-input-group>
    <nz-input-group nzAddOnBefore="法人手机号">
      <input type="text" nz-input [(ngModel)]="doc.legalpersontel">
    </nz-input-group>
    <nz-input-group nzAddOnBefore="餐厅负责人" *ngIf="doc.name">
      <nz-select style="width: 100%;" nzPlaceHolder="请选择负责人" nzAllowClear [(ngModel)]="doc.legaluserid" [disabled]="doc.legaluserid">
        <nz-option *ngFor="let item of legaluserItems" [nzLabel]="item.name" [nzValue]="item._id">
        </nz-option>
      </nz-select>
    </nz-input-group>
    <nz-input-group nzAddOnBefore="品牌宣传大使" *ngIf="doc.name">
      <nz-select style="width: 100%;" nzPlaceHolder="请选择品牌宣传大使" nzAllowClear [(ngModel)]="doc.agent" [disabled]="doc.agent">
        <nz-option *ngFor="let item of agentItems" [nzLabel]="item.name" [nzValue]="item._id">
        </nz-option>
      </nz-select>
    </nz-input-group>
    <nz-input-group nzAddOnBefore="申请时间">
      <nz-date-picker nzFormat="yyyy-MM-dd" [(ngModel)]="doc.applytime" nzPlaceHolder="申请时间">
      </nz-date-picker>
    </nz-input-group>
    <nz-input-group nzAddOnBefore="餐厅地址">
      <input type="text" nz-input [(ngModel)]="doc.address">
    </nz-input-group>
    <nz-input-group nzAddOnBefore="餐厅联系电话">
      <input type="text" nz-input [(ngModel)]="doc.tel">
    </nz-input-group>
    <nz-input-group nzAddOnBefore="餐厅所属菜系">
      <nz-select nzMode="tags" style="width: 100%;" nzPlaceHolder="请选择菜系" [(ngModel)]="doc.cuisine">
        <nz-option *ngFor="let item of cuisineItems" [nzLabel]="item.name" [nzValue]="item.name">
        </nz-option>
      </nz-select>
    </nz-input-group>
    <nz-input-group nzAddOnBefore="餐厅星级">
        <nz-input-number [(ngModel)]="doc.star" [nzMin]="1" [nzMax]="5" [nzStep]="1"></nz-input-number>
      <!-- <input type="text" nz-input [(ngModel)]="doc.star"> -->
    </nz-input-group>
    <nz-input-group  nzAddOnBefore="人均消费额">
        <nz-input-number  [(ngModel)]="doc.percapita" [nzMin]="1" [nzMax]="10000" [nzStep]="1" (ngModelChange)="calsIpputRate()"></nz-input-number>
      <!-- <input type="text" nz-input [(ngModel)]="doc.percapita"> -->
    </nz-input-group>
    <nz-input-group nzAddOnBefore="佣金比例(%)" >
        <nz-input-number [(ngModel)]="doc.rate" [nzMin]="1" [nzMax]="100" [nzStep]="1"></nz-input-number>
      <!-- <input type="text" nz-input [(ngModel)]="doc.rate"> -->
      
    </nz-input-group>
    <!-- <nz-input-group nzAddOnBefore="提示">
        <input type="text" nz-input [(ngModel)]="yjbl">
    </nz-input-group> -->
    <nz-input-group nzAddOnBefore="酒币数量">
        <nz-input-number [(ngModel)]="doc.coinbalance" [nzMin]="0" [nzMax]="10000" [nzStep]="1"></nz-input-number>
        <!-- <input type="text" nz-input [(ngModel)]="doc.coinbalance"> -->
      </nz-input-group>
    <nz-input-group nzAddOnBefore="餐厅描述">
      <input type="text" nz-input [(ngModel)]="info.lable">
    </nz-input-group>
    <nz-input-group nzAddOnBefore="营业时间">
      <input type="text" nz-input [(ngModel)]="info.hours">
    </nz-input-group>
    <nz-input-group nzAddOnBefore="客厅面积">
        <nz-input-number [(ngModel)]="info.area" [nzMin]="0" [nzMax]="10000" [nzStep]="1"></nz-input-number>
      <!-- <input type="text" nz-input [(ngModel)]="info.area"> -->
    </nz-input-group>
    <nz-input-group nzAddOnBefore="餐桌数量">
        <nz-input-number [(ngModel)]="info.table" [nzMin]="0" [nzMax]="10000" [nzStep]="1"></nz-input-number>
      <!-- <input type="text" nz-input [(ngModel)]="info.table"> -->
    </nz-input-group>
    <nz-input-group nzAddOnBefore="可坐人数">
        <nz-input-number [(ngModel)]="info.number" [nzMin]="0" [nzMax]="10000" [nzStep]="1"></nz-input-number>
      <!-- <input type="text" nz-input [(ngModel)]="info.number"> -->
    </nz-input-group>
    <nz-input-group nzAddOnBefore="开户行">
      <input type="text" nz-input [(ngModel)]="doc.Bank">
    </nz-input-group>
    <nz-input-group nzAddOnBefore="卡号">
      <input type="text" nz-input [(ngModel)]="doc.BankCardNumber">
    </nz-input-group>
    <nz-input-group nzAddOnBefore="餐厅logo图片" id="nav">
      <div>
        <nz-upload class="avatar-uploader" [nzAction]="action" nzName="file" nzListType="picture-card"
          [nzShowUploadList]="false" [nzBeforeUpload]="beforeUpload" (nzChange)="handleChange($event,'logo')">
          <ng-container *ngIf="!doc.logoimage">
            <i nz-icon type="plus"></i>
            <div class="ant-upload-text">上传</div>
          </ng-container>
          <img *ngIf="doc.logoimage" [src]="doc.logoimage" class="avatar">
        </nz-upload>
      </div>
    </nz-input-group>
    <nz-input-group nzAddOnBefore="餐厅轮播图片" id="nav">
      <ul>
        <li>
          <nz-upload class="avatar-uploader" [nzAction]="action" nzName="file" nzListType="picture-card" title="点击上传图片"
            [nzShowUploadList]="false" [nzBeforeUpload]="beforeUpload" (nzChange)="handleChange($event,'img')">
            <ng-container>
              <i nz-icon type="plus"></i>
              <div class="ant-upload-text">上传图片</div>
            </ng-container>
          </nz-upload>
        </li>
        <li><img *ngFor="let img of info.imgs" [src]="img" class="avatar" (click)="deleteimg(img)" title="点击删除" style="cursor: pointer;"></li>
      </ul>
    </nz-input-group>
  </div>
</nz-modal>